<?php

function get_recipe($id){
    $query = sprintf("SELECT * FROM recipe WHERE r_id = %d", $id);
    $qid = mysql_query($query);
    $recipe = mysql_fetch_object($qid);
    $recipe -> ingredients = print_ingredients($id);
//print_r($recipe);
    return $recipe;
}



function save_recipe($r_name, $r_content){
$query = sprintf("INSERT INTO  `recipe` ( `r_id` , `r_name` , `r_content` ) VALUES ( NULL ,  '%s' ,  '%s')", $r_name, $r_content );
    
     $result = mysql_query($query);
    if (!$result) {
      die('Invalid query: ' . mysql_error());
    }
    return mysql_insert_id();
}
?>
